﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BLL;
namespace 健身房管理
{
    public partial class wuyiModify : Form
    {
        public int wyid = 0;
        wuyiBLL wbl = new wuyiBLL();
        Point mouseOff;//鼠标移动位置变量
        bool leftFlag;//标签是否为左键

        private void mAdd_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                mouseOff = new Point(-e.X, -e.Y);
                leftFlag = true;
            }
        }

        private void mAdd_MouseMove(object sender, MouseEventArgs e)
        {
            if (leftFlag)
            {
                Point mouseSet = Control.MousePosition;
                mouseSet.Offset(mouseOff.X, mouseOff.Y);//设置移动后的位置
                Location = mouseSet;
            }
        }

        private void mAdd_MouseUp(object sender, MouseEventArgs e)
        {
            if (leftFlag)
            {
                leftFlag = false;//释放鼠标后标注为False
            }
        }
        public wuyiModify()
        {
            InitializeComponent();
        }

        private void guna2Button1_Click(object sender, EventArgs e)
        {
            this.Close();  
        }

        private void wuyiModify_Load(object sender, EventArgs e)
        {
            wuyixgfz();
        }
        public void wuyixgfz()
        {
            DataTable dt = wbl.wumodifyShow(wyid);
            if (dt.Rows.Count > 0)
            {
                this.wuyname.Text = dt.Rows[0]["yname"].ToString();
                this.pickplaces.Text = dt.Rows[0]["pickplace"].ToString();
                this.pickuname.Text = dt.Rows[0]["pickuname"].ToString();
                this.picktel.Text = dt.Rows[0]["pickutel"].ToString();
                this.pictime.Text = dt.Rows[0]["Ctime"].ToString();
                this.lqzt.Text = dt.Rows[0]["Cstatus"].ToString();
            }
            else
            {

            }
        }
        private void guna2Button3_Click(object sender, EventArgs e)
        {
            string ywname = wuyname.Text;
            string pickplace = pickplaces.Text;
            string pickun = pickuname.Text;
            string pictel = picktel.Text;
            string pictim = pictime.Text;
            string Cstatus = lqzt.Text;
            bool B1 = wbl.wuyimodify(ywname,pickplace,pickun,pictel,pictim,Cstatus,wyid);
            if (B1)
            {
                MessageBox.Show("修改成功");
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }

        private void wuyiModify_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                mouseOff = new Point(-e.X, -e.Y);
                leftFlag = true;
            }
        }

        private void wuyiModify_MouseMove(object sender, MouseEventArgs e)
        {
            if (leftFlag)
            {
                Point mouseSet = Control.MousePosition;
                mouseSet.Offset(mouseOff.X, mouseOff.Y);//设置移动后的位置
                Location = mouseSet;
            }
        }

        private void wuyiModify_MouseUp(object sender, MouseEventArgs e)
        {
            if (leftFlag)
            {
                leftFlag = false;//释放鼠标后标注为False
            }
        }
    }
}
